package com.owo.springboot.repository;


import com.owo.springboot.entity.Reservation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;

public interface ReservationRepository extends JpaRepository<Reservation, Long> {
    @Query("SELECT r.plateParkId FROM Reservation r WHERE r.plateParkId IS NOT NULL")
    List<String> findAllByPlateParkIdNotNull();

    @Query("SELECT r.id FROM Reservation r WHERE r.userId = :userId")
    List<String> findAllIdsByUserId(String userId);

    @Query("SELECT r FROM Reservation r WHERE r.userId = :userId")
    List<Reservation> findAllByUserId(String userId);

    Optional<Reservation> findById(String orderId);
}
